using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TipsBoardStory : MonoBehaviour
{

    public GameObject separatorGO;
    private GameObject tipsPanelGO;
    public RoomController roomCtr;
    public string content;
    public Monster monster;

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer.Equals(9))
        {
            if (content.Length != 0)
            {
                content = content.Replace("\\n", "\n");
                tipsPanelGO = GameController.Instance().panelCtr.LoadTipsPanel(content);
            }
            if (separatorGO)
            {
                separatorGO.SetActive(false);
            }

            if (gameObject.name.Equals("TipsBoard1"))
            {
                GameController.Instance().archiveCtr.TempLevelData.storyRoomNum = 1;
            }
            else if (gameObject.name.Equals("TipsBoard3"))
            {
                GameController.Instance().archiveCtr.TempLevelData.storyRoomNum = 3;
            }
            else if (gameObject.name.Equals("TipsBoard4") && monster)
            {
                GameController.Instance().panelCtr.LoadBossPanel(monster);
            }
            
        }
    }

    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.gameObject.layer.Equals(9))
        {
            if (roomCtr)
            {
                roomCtr.enabled = true;
            }
            Destroy(tipsPanelGO);
        }
    }
}
